<script setup>
import { ref } from 'vue';
import { useDictStore } from '@/store/modules/dict';
const data = defineModel('data', { type: Object, default: () => ({}) });

const { store } = useDictStore();

const stateObj = ref({
  WORK: '',
  WAIT: '',
  ALARM: '',
  IDLE: '',
  STOP: ''
});

store.drilling_equipment_state.forEach(item => {
  stateObj.value[item.value] = item.label;
});
</script>

<template>
  <ADescriptions title="" :column="2" bordered size="small">
    <ADescriptionsItem label="设备名称">{{ data.subEqpName }}</ADescriptionsItem>
    <ADescriptionsItem label="时间">{{ data.dateTime }}</ADescriptionsItem>
    <ADescriptionsItem label="直径表名称">{{ data.diaPath }}</ADescriptionsItem>
    <ADescriptionsItem label="程序加工百分数">
      <AProgress :percent="Number(data.runPresent)" :stroke-color="{ '0%': '#108ee9', '100%': '#87d068' }"></AProgress>
    </ADescriptionsItem>
    <ADescriptionsItem label="钻带名称">
      {{ data.pgmPath }}
    </ADescriptionsItem>
    <ADescriptionsItem label="稼动率">
      {{ data.duty }}
    </ADescriptionsItem>
    <ADescriptionsItem label="开机时间">
      {{ data.shiftOperateTime }}
    </ADescriptionsItem>
    <ADescriptionsItem label="加工时间">
      {{ data.lotRunTime }}
    </ADescriptionsItem>
    <ADescriptionsItem label="等待时间">
      {{ data.shiftWaitTime }}
    </ADescriptionsItem>
    <ADescriptionsItem label="错误时间">
      {{ data.shiftErrorTime }}
    </ADescriptionsItem>
    <ADescriptionsItem label="机台当前状态">
      <span class="equipment-status" :class="data.equipmentStatus">
        {{ stateObj[data.equipmentStatus] }}
      </span>
    </ADescriptionsItem>
    <ADescriptionsItem label="轴开启状态">
      {{ data.axisStatus }}
    </ADescriptionsItem>
    <ADescriptionsItem label="主轴开启数量">
      {{ data.axisRunCount }}
    </ADescriptionsItem>
  </ADescriptions>
</template>

<style lang="scss" scoped>
.equipment-status {
  &.WORK {
    color: #1cd66c;
  }
  &.WAIT {
    color: #8e9dff;
  }
  &.ALARM {
    color: #ff3030;
  }
  &.IDLE {
    color: #26deca;
  }
  &.STOP {
    color: #fedc69;
  }
}
</style>
